package com.fanyouzhao.joker.service;

import okhttp3.*;
import java.io.IOException;

/**
 * author: fanyouzhao
 * date: 15:14 2021/9/18
 */
public class GetUserMission {
    public static void send(String token){
        OkHttpClient client = new OkHttpClient().newBuilder()
                .build();
        RequestBody body = new FormBody.Builder()
                .add("count", "10")
                .add("paged", "1")
                .build();
        Request request = new Request.Builder()
                .url("https://vip.jokerps.com/wp-json/b2/v1/getUserMission")
                .addHeader("Authorization", "Bearer "+token)
                .addHeader("Content-Type", "application/x-www-form-urlencoded")
                .post(body)
                .build();
        try {
            Response response = client.newCall(request).execute();
            String responseData = null;
            if (response.body() != null) {
                responseData = response.body().string();
            }
            System.out.println("------------------------getUserMission响应------------------------\n"
                    + responseData);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
